/*
 * CustomFontSet.java  0.4.0 / Oct 25, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
package com.cute4j.swing.styles;

import com.cute4j.swing.Swing;
import com.cute4j.swing.graphics.Font;

/**
 * Custom Font Set.
 *
 * @cute4j.native
 *    generate="header"
 *
 * @author Slobodan Vrkacevic
 * @version 0.4.0
 */
public class CustomFontSet extends FontSet {

// Static Initialization. ------------------------------------------------------

  static {
    Swing.initialize();
  }

// Private Fields. -------------------------------------------------------------

  private int hashCode; // NOPMD

// Protected Fields. -----------------------------------------------------------

  protected String name;
  protected Font defaultFont;
  protected Font fixedFont;
  protected Font componentFont;
  protected Font buttonFont;
  protected Font menuFont;
  protected Font menuBarFont;
  protected Font textFont;
  protected Font toolTipFont;

// Public Constructors. --------------------------------------------------------

  /**
   * Constructs new CustomFontSet object.
   */
  public CustomFontSet() {
    // empty constructor
  }

  /**
   * Constructs new CustomFontSet object.
   *
   * @param name the name
   */
  public CustomFontSet(String name) {
    this.name = name;
    _fillFontSet(name); // NOPMD
  }

  /**
   * Constructs new CustomFontSet object.
   *
   * @param defaultFont the default font
   */
  public CustomFontSet(Font defaultFont) {
    this(null, defaultFont);
  }

  /**
   * Constructs new CustomFontSet object.
   *
   * @param name the name
   * @param defaultFont the default font
   */
  public CustomFontSet(String name, Font defaultFont) {
    this.name = name;
    this.defaultFont = defaultFont;
    this.componentFont = defaultFont;
    this.buttonFont = defaultFont;
    this.menuFont = defaultFont;
    this.menuBarFont = defaultFont;
    this.textFont = defaultFont;
    this.toolTipFont = defaultFont;
  }

// Public Methods. -------------------------------------------------------------

  /**
   * Sets default font.
   *
   * @param defaultFont the default font
   */
  public void setDefaultFont(Font defaultFont) {
    this.defaultFont = defaultFont;
  }

  /**
   * Sets fixed font.
   *
   * @param fixedFont the fixed font
   */
  public void setFixedFont(Font fixedFont) {
    this.fixedFont = fixedFont;
  }

  /**
   * Sets component font.
   *
   * @param componentFont the component font
   */
  public void setComponentFont(Font componentFont) {
    this.componentFont = componentFont;
  }

  /**
   * Sets button font.
   *
   * @param buttonFont the button font
   */
  public void setButtonFont(Font buttonFont) {
    this.buttonFont = buttonFont;
  }

  /**
   * Sets menu font.
   *
   * @param menuFont the menu font
   */
  public void setMenuFont(Font menuFont) {
    this.menuFont = menuFont;
  }

  /**
   * Sets menu bar font.
   *
   * @param menuBarFont the menu bar font
   */
  public void setMenuBarFont(Font menuBarFont) {
    this.menuBarFont = menuBarFont;
  }

  /**
   * Sets text font.
   *
   * @param textFont the text font
   */
  public void setTextFont(Font textFont) {
    this.textFont = textFont;
  }

  /**
   * Sets tool tip font.
   *
   * @param toolTipFont the tool tip font
   */
  public void setToolTipFont(Font toolTipFont) {
    this.toolTipFont = toolTipFont;
  }

// FontSet Interface Implementation. -------------------------------------------

  /**
   * {@inheritDoc}
   */
  public int hashCode() { // NOPMD
    if (hashCode == 0) {
      hashCode = super.hashCode();
    }
    return hashCode; // NOFB
  }

  /**
   * {@inheritDoc}
   */
  public String getName() {
    return name;
  }

  /**
   * {@inheritDoc}
   */
  public Font getDefaultFont() {
    return defaultFont;
  }

  /**
   * {@inheritDoc}
   */
  public Font getFixedFont() {
    return fixedFont;
  }

  /**
   * {@inheritDoc}
   */
  public Font getComponentFont() {
    return componentFont;
  }

  /**
   * {@inheritDoc}
   */
  public Font getButtonFont() {
    return buttonFont;
  }

  /**
   * {@inheritDoc}
   */
  public Font getMenuFont() {
    return menuFont;
  }

  /**
   * {@inheritDoc}
   */
  public Font getMenuBarFont() {
    return menuBarFont;
  }

  /**
   * {@inheritDoc}
   */
  public Font getTextFont() {
    return textFont;
  }

  /**
   * {@inheritDoc}
   */
  public Font getToolTipFont() {
    return toolTipFont;
  }

// Package-Private Native Methods. ---------------------------------------------

  native void _fillFontSet(String name);

}
